package com.example.foobar.dao.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.foobar.dto.DABaseDTO;
import com.example.foobar.entity.ImsGhostCustomActiveRecord;
import com.example.foobar.mapper.ImsGhostCustomActiveRecordMapper;
import com.example.foobar.dao.service.ImsGhostCustomActiveRecordDaoService;
import com.example.foobar.param.ImsGhostCustomActiveRecordPageParam;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.core.pagination.PageInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.transaction.annotation.Transactional;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import java.util.Map;

/**
 *  服务实现类
 *
 * @author 郑英奔
 * @since 2021-07-12
 */
@Slf4j
@Service
@DS("db1")
public class ImsGhostCustomActiveRecordDaoServiceImpl extends BaseServiceImpl<ImsGhostCustomActiveRecordMapper, ImsGhostCustomActiveRecord> implements ImsGhostCustomActiveRecordDaoService {

    @Autowired
    private ImsGhostCustomActiveRecordMapper imsGhostCustomActiveRecordMapper;

    @Transactional(rollbackFor = Exception.class)
    @Override
    public boolean saveImsGhostCustomActiveRecord(ImsGhostCustomActiveRecord imsGhostCustomActiveRecord)  {
        return super.save(imsGhostCustomActiveRecord);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public boolean updateImsGhostCustomActiveRecord(ImsGhostCustomActiveRecord imsGhostCustomActiveRecord) {
        return super.updateById(imsGhostCustomActiveRecord);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public boolean deleteImsGhostCustomActiveRecord(Long id){
        return super.removeById(id);
    }

    @Override
    public List<DABaseDTO> getActiveDataByOfficialAccountIdAndDataRange(Map<String, Object> params) {
        return imsGhostCustomActiveRecordMapper.getActiveDataByOfficialAccountIdAndDataRange(params);
    }

    @Override
    public List<DABaseDTO> getSubscribeCount(Map<String, Object> params) {
        return imsGhostCustomActiveRecordMapper.getSubscribeCount(params);
    }

    @Override
    public List<ImsGhostCustomActiveRecord> listByDate(Map<String, Object> params) {
        return imsGhostCustomActiveRecordMapper.listByDate(params);
    }

    @Override
    public List<DABaseDTO> getActiveDataByOfficialSceneIdAndDataRange(Map<String, Object> params) {
        return imsGhostCustomActiveRecordMapper.getActiveDataByOfficialSceneIdAndDataRange(params);
    }

    @Override
    public int getSubscribeCountBySceneId(Map<String, Object> params) {
        return imsGhostCustomActiveRecordMapper.getSubscribeCountBySceneId(params);
    }
}
